ISSDK  1.8
IoT Sensing Software Development Kit
lpc55s16.c
Go to the documentation of this file.
1 /*
2  * Copyright 2019 - 2022 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 /**
9  * @file lpc55s16.c
10  * @brief The lpc55s16.c file defines GPIO pins and I2C CMSIS utilities for LPCXpresso55s16 board.
11  */
12 
13 #include "lpc55s16.h"
14 
15 // I2C4 Pin Handles
16 /* [PIO1_21] (coords: 30) configured as FC4_RXD_SDA_MOSI */
18  .pinNumber = 21,
19  .mask = 1 << (21),
20  .clockName = kCLOCK_Gpio1,
21  .portNumber = kGINT_Port1};
22 /* [PIO1_20] (coords: 4) configured as FC4_TXD_SCL_MISO */
24  .pinNumber = 20,
25  .mask = 1 << (20),
26  .clockName = kCLOCK_Gpio1,
27  .portNumber = kGINT_Port1};
28 
29 // SPI7 Handle
30 /* [PIO0_20] (coords: 74) configured as SPI master-out/slave-in (MOSI) data */
32  .pinNumber = 26,
33  .mask = 1 << (26),
34  .clockName = kCLOCK_Gpio0,
35  .portNumber = kGINT_Port0};
36 /* [PIO0_19] (coords: 90) is configured as SPI master-in/slave-out (MISO) data */
38  .pinNumber = 3,
39  .mask = 1 << (3),
40  .clockName = kCLOCK_Gpio1,
41  .portNumber = kGINT_Port1};
42 /* [PIO0_21] (coords: 76) configured as SPI SCK */
44  .pinNumber = 2,
45  .mask = 1 << (2),
46  .clockName = kCLOCK_Gpio1,
47  .portNumber = kGINT_Port1};
48 /* [PIO0_21] (coords: 76) configured as SPI CS */
50  .pinNumber = 1,
51  .mask = 1 << (1),
52  .clockName = kCLOCK_Gpio1,
53  .portNumber = kGINT_Port1};
54 
55 // UART0 Handle
56 /* [PIO0_29] (coords: 92) configured as USART RXD */
58  .pinNumber = 29,
59  .mask = 1 << (29),
60  .clockName = kCLOCK_Gpio0,
61  .portNumber = kGINT_Port0};
62 /* [PIO0_30] (coords: 94) configured as USART TXD */
64  .pinNumber = 30,
65  .mask = 1 << (30),
66  .clockName = kCLOCK_Gpio0,
67  .portNumber = kGINT_Port0};
68 
69 // LPCXpresso55s69 Internal Peripheral Pin Definitions
71  .pinNumber = 4,
72  .mask = 1 << (4),
73  .clockName = kCLOCK_Gpio1,
74  .portNumber = kGINT_Port1};
76  .pinNumber = 7,
77  .mask = 1 << (7),
78  .clockName = kCLOCK_Gpio1,
79  .portNumber = kGINT_Port1};
81  .pinNumber = 6,
82  .mask = 1 << (6),
83  .clockName = kCLOCK_Gpio1,
84  .portNumber = kGINT_Port1};
85 
86 /*!
87  * @brief Kinetis style Wrapper API for handling all Clock related configurations.
88  *
89  * @param void
90  * @return void
91  */
93 {
94  /* attach 12 MHz clock to FLEXCOMM0 (debug/UART0) */
95  CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0);
96  /* attach 12 MHz clock to FLEXCOMM4 (I2C4) */
97  CLOCK_AttachClk(kFRO12M_to_FLEXCOMM4);
98  /* attach 12 MHz clock to FLEXCOMM4 (SPI7) */
99  CLOCK_AttachClk(kFRO12M_to_FLEXCOMM7);
100  /* Configure FROHF96M Clock */
101  BOARD_BootClockPLL150M();
102 }
103 
104 /*!
105  * @brief Configures the system to WAIT power mode.
106  * API name used from Kinetis family to maintain compatibility.
107  *
108  * @param Power peripheral base address (dummy).
109  * @return Configuration error code.
110  */
111 status_t SMC_SetPowerModeWait(void *arg)
112 {
113  //POWER_EnterSleep();
114 
115  return kStatus_Success;
116 }
117 
118 /*!
119  * @brief Configures the system to VLPR power mode.
120  * API name used from Kinetis family to maintain compatibility.
121  *
122  * @param Power peripheral base address (dummy).
123  * @return Configuration error code.
124  */
125 status_t SMC_SetPowerModeVlpr(void *arg)
126 {
127  POWER_EnterSleep();
128 
129  return kStatus_Success;
130 }
131 
132 /*! @brief Determines the Clock Frequency feature.
133  * @details The Clock Frequecny computation API required by fsl_uart_cmsis.c.
134  * @param[in] void
135  * @Constraints None
136  * @Reentrant Yes
137  * @return uint32_t Returns the clock frequency .
138  */
139 uint32_t USART0_GetFreq(void)
140 {
141  return CLOCK_GetFlexCommClkFreq(0U);
142 }
143 
144 /*! @brief Determines the Clock Frequency feature.
145  * @details The Clock Frequecny computation API required by fsl_i2c_cmsis.c.
146  * @param[in] void
147  * @Constraints None
148  * @Reentrant Yes
149  * @return uint32_t Returns the clock frequency .
150  */
151 uint32_t I2C4_GetFreq(void)
152 {
153  return CLOCK_GetFlexCommClkFreq(4U);
154 }
155 
156 /*! @brief Determines the Clock Frequency feature.
157  * @details The Clock Frequecny computation API required by fsl_spi_cmsis.c.
158  * @param[in] void
159  * @Constraints None
160  * @Reentrant Yes
161  * @return uint32_t Returns the clock frequency .
162  */
163 uint32_t SPI8_GetFreq(void)
164 {
165  return CLOCK_GetFlexCommClkFreq(8U);
166 }
gpioHandleKSDK_t D1
Definition: lpc55s16.c:63
uint32_t SPI8_GetFreq(void)
Determines the Clock Frequency feature.
Definition: lpc55s16.c:163
status_t SMC_SetPowerModeVlpr(void *arg)
Configures the system to VLPR power mode. API name used from Kinetis family to maintain compatibility...
Definition: lpc55s16.c:125
The lpc55s16.h file defines GPIO pin mappings for LPCXpresso55S16 board.
status_t SMC_SetPowerModeWait(void *arg)
Configures the system to WAIT power mode. API name used from Kinetis family to maintain compatibility...
Definition: lpc55s16.c:111
gpioHandleKSDK_t D13
Definition: lpc55s16.c:43
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:49
gpioHandleKSDK_t D15
Definition: lpc55s16.c:23
gpioHandleKSDK_t D14
Definition: lpc55s16.c:17
gpioHandleKSDK_t D0
Definition: lpc55s16.c:57
GPIO_Type * base
Definition: gpio_driver.h:51
gpioHandleKSDK_t RED_LED
Definition: lpc55s16.c:70
uint32_t USART0_GetFreq(void)
Determines the Clock Frequency feature.
Definition: lpc55s16.c:139
uint32_t I2C4_GetFreq(void)
Determines the Clock Frequency feature.
Definition: lpc55s16.c:151
gpioHandleKSDK_t D11
Definition: lpc55s16.c:31
void BOARD_BootClockRUN(void)
Kinetis style Wrapper API for handling all Clock related configurations.
Definition: lpc55s16.c:92
gpioHandleKSDK_t D10
Definition: lpc55s16.c:49
gpioHandleKSDK_t D12
Definition: lpc55s16.c:37
gpioHandleKSDK_t GREEN_LED
Definition: lpc55s16.c:75
gpioHandleKSDK_t BLUE_LED
Definition: lpc55s16.c:80